CREATE ROLE [ESBPortalAdmin]
    AUTHORIZATION [dbo];
GO

-- Assign object level permissions to Database Roles
-- ESBPortalAdmin Permissions
GRANT EXECUTE ON usp_select_Reports_AlertSubscriptionsOverTime TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_select_Reports_AlertSubscriptionsOverTime_ByService TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_select_AlertHistoryByName TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_select_AlertHistoryReportByService TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_select_AlertHistoryReportByApplication_Over_Time TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_select_AlertSubscription_Count_Over_Time_By_Application_ServiceName TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_select_AlertSubscription_Count_Over_Time_By_Application TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_delete_AlertConditionByID TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_insert_AlertCondition TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_select_AlertConditionsByAlertID TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_select_Active_AlertSubscriptions TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_update_AlertSubscriptionByID TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_insert_AlertSubscription TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_select_AlertSubscriptions TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_select_AlertSubscriptionsByAlertID TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_insert_AlertSubscriptionHistory TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_insert_ProcessedFault TO ESBPortalAdmin
GO

GRANT SELECT ON Fault TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_select_Configuration TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_update_Configuration TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_select_Fault_Count_By_ServiceName TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_insert_UserSetting TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_select_Fault_Count_Over_Time_By_ServiceName TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_select_Fault_Count_By_Application TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_update_AlertEmail TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_select_AlertSubscriptionsBySubscriber TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_delete_AlertSubscriptionByID TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_select_Faults TO ESBPortalAdmin
GO

GRANT INSERT ON UserSetting TO ESBPortalAdmin
GO

GRANT SELECT ON UserSetting TO ESBPortalAdmin
GO

GRANT UPDATE ON UserSetting TO ESBPortalAdmin
GO

GRANT SELECT ON AlertEmail TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_select_Reports_Alerts TO ESBPortalAdmin
GO

GRANT SELECT ON Alert TO ESBPortalAdmin
GO

GRANT SELECT ON Batch TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_select_Fault_Count_By_Error_Type TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_select_Fault_Count_By_Error_Type_By_Application TO ESBPortalAdmin
GO

GRANT SELECT ON ProcessedFault TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_select_FaultsToQueue TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_select_AlertEmail TO ESBPortalAdmin
GO

GRANT INSERT ON Configuration TO ESBPortalAdmin
GO

GRANT SELECT ON Configuration TO ESBPortalAdmin
GO

GRANT UPDATE ON Configuration TO ESBPortalAdmin
GO

GRANT DELETE ON AlertCondition TO ESBPortalAdmin
GO

GRANT INSERT ON AlertCondition TO ESBPortalAdmin
GO

GRANT SELECT ON AlertCondition TO ESBPortalAdmin
GO

GRANT UPDATE ON AlertCondition TO ESBPortalAdmin
GO

GRANT DELETE ON AlertSubscription TO ESBPortalAdmin
GO

GRANT INSERT ON AlertSubscription TO ESBPortalAdmin
GO

GRANT SELECT ON AlertSubscription TO ESBPortalAdmin
GO

GRANT UPDATE ON AlertSubscription TO ESBPortalAdmin
GO

GRANT SELECT ON AlertSubscriptionHistory TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_delete_AlertByID TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_select_AlertByID TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_insert_Alert TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_select_Alerts TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_select_AlertStatistics TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_update_Alert TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_select_NonSubscribedAlertStatistics TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_select_Reports_ResubmissionsByService TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_select_Fault_Count_Over_Time_By_Application_By_Month TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_select_Fault_Count_Over_Time_By_Application_By_Hour TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_select_Fault_Count_Over_Time_By_Application_By_Day TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_select_Fault_Count_Over_Time_By_Application_By_Minute TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_select_Fault_Count_Over_Time_By_ErrorType TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_select_Fault_Count_By_Application_GroupByServices TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_select_Fault_Count_Over_Time_By_Service TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_select_Fault_Count_Over_Time_By_Service_And_Hour TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_select_AlertHistoryReportByServiceFault TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_select_Faults_Messages TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_select_Fault_Count TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_select_Single_Fault TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_insert_Fault TO ESBPortalAdmin
GO

GRANT SELECT ON vw_AggregatedFaults TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_select_Fault_Count_Over_Time_By_Application TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_insert_AuditLog TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_select_Faults_By_Application_And_ErrorType TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_select_Fault_Count_Over_Time_By_Application_ServiceName TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_select_Resubmission_Count_Over_Time_By_Application_ServiceName TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_select_Faults_By_Application_And_Services TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_select_Faults_From_AlertHistoryReportByServiceFault TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_select_AlertHistoryReportByApplication TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_select_Resubmission_Count_Over_Time_By_Application TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_select_Reports_Resubmissions_ByService TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_select_Reports_Resubmissions TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_select_AuditLog TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_insert_ContextProperty TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_select_ContextProperties TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_select_Messages TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_insert_Message TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_select_MessageBody TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_select_CanResubmitMessage TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_update_Message TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_insert_AlertEmail TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_insert_Batch TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_update_Batch TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_insert_AlertHistory TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_select_AlertHistory_Count TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_select_AlertHistory TO ESBPortalAdmin
GO

GRANT EXECUTE ON usp_select_Reports_AlertHistoryOverTime TO ESBPortalAdmin
GO
